#include <iostream>
#include <string>
#include <vector>
using namespace std;

bool judge(const string& str) {
    if (str.empty())
        return false;
    for (int i = 1; i < str.size(); i++) {
        if (str[i] != str[0])
            return true;
    }
    return false;
}

int main() {
    int n;
    string str;
    int count = 0;
    cin >> n >> str;
    while (judge(str)) {
        vector<bool> str_stats(str.size(),true);
       int top = 0;
       while(top < str.size()){
           char c = str[top++];
           while(str[top] == c){
               top++;
           }
           str_stats[top] = false;
       }
       string s;
       for(int i = 0 ;i < str.size();i++){
            if(str_stats[i])
                s += str[i];
       }
       count += str.size() - s.size();
       str = s;
    }

    cout << count << endl;
    return 0;
}